import mongoose  from 'mongoose'
import BaseModel from "./base_model"

let Schema    = mongoose.Schema;
let ObjectId  = Schema.ObjectId;

var MenuSchema = new Schema({
  appId:           { type: String, requried: true },
  zoneId:          { type: ObjectId, requried: true },
  parent_id:       { type: ObjectId },
  key:             { type: String, requried: true },
  value:           { type: String, requried: true },
  deleted:         { type: Boolean, default: false },
  enable:          { type: Boolean, default: false },
  weight:          { type: Number, default: 0 },
  create_at:       { type: Date, default: Date.now },
});
MenuSchema.plugin(BaseModel);
MenuSchema.index({create_at: -1});

mongoose.model('Menu', MenuSchema);